package cn.samler.diandi.api.model.io.request.pub;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

@Data
public class Page {
    @Min(value = 1, message = "the minimum page number is 1")
    private int page = 1;

    @Min(value = 5, message = "the minimum offset number is 5")
    @Max(value = 50, message = "the maximum offset number is 50")
    private int offset = 10;

    @JsonIgnore
    public int getStart() {
        return (page - 1) * offset;
    }
}
